package 蓝桥.模拟赛;

import java.util.Arrays;

public class Main5 {
    // 回溯
    int max = Integer.MIN_VALUE;

    void backtrace(int i, int[] nums, int sum) {
        if (i == nums.length) {
            if(sum%24==0 && sum>max){
                max = sum;
                System.out.println(max);
            }
            return;
        }
        backtrace(i + 1, nums, sum + nums[i]);
        backtrace(i + 1, nums, sum);


    }

    public static void main(String[] args) {
        int[] nums = {534, 386, 319, 692, 169, 338, 521, 713, 640, 692, 969, 362, 311, 349, 308, 357, 515, 140, 591, 216,

                57, 252, 575, 630, 95, 274, 328, 614, 18, 605, 17, 980, 166, 112, 997, 37, 584, 64, 442, 495,

                821, 459, 453, 597, 187, 734, 827, 950, 679, 78, 769, 661, 452, 983, 356, 217, 394, 342, 697, 878,

                475, 250, 468, 33, 966, 742, 436, 343, 255, 944, 588, 734, 540, 508, 779, 881, 153, 928, 764, 703,

                459, 840, 949, 500, 648, 163, 547, 780, 749, 132, 546, 199, 701, 448, 265, 263, 87, 45, 828, 634};

        int sum = 0;
        for (int i : nums) {
            sum += i;
        }
        System.out.println(nums.length);
        System.out.println(sum);
        System.out.println((double) sum / 24.0);

        System.out.println(sum%24);
        for (int i = 0; i < nums.length; i++) {
            System.out.printf("%d ", nums[i] %24);
        }
        for (int i = 0; i < nums.length; i++) {
            if(nums[i]%24==0){
                System.out.println(nums[i]);
            }
        }
        Arrays.sort(nums);
        for (int i = 0; i < nums.length; i++) {
            System.out.printf("%d ", nums[i]);
        }
        System.out.printf("\n");
        for (int i = 0; i < nums.length; i++) {
            System.out.printf("%d ", nums[i]%24);
        }

        Main5 m = new Main5();
//        m.backtrace(0, nums, 0);

    }
}
